if CLIENT then

	Perk = {}
	Perk.Cooldown = 0
	Perk.Type = ""

	//Marksman radar

	function RadarDraw()
		if LocalPlayer():GetNWBool("markenemies") then
			for k,v in pairs(player.GetAll()) do
				if v != LocalPlayer() and v:Alive() and v:Team() != LocalPlayer():Team() then
					local Box = GetBoxSize(v)
					draw.RoundedBox(2,Box.x-Box.w/2,Box.y-Box.h,Box.w,Box.h, Color(255,0,0,100))
				end
			end
		end
	end

	function GetBoxSize(ply)
		LP = LocalPlayer():GetPos()
		TP = ply:GetPos()
		local BSize = {}
		BSize.x = TP:ToScreen().x
		BSize.y = TP:ToScreen().y
		BSize.h = -ply:NearestPoint(TP+Vector(0,0,500)):ToScreen().y+TP:ToScreen().y
		BSize.w = BSize.h/2.5
		return BSize
	end

	hook.Add("HUDPaint","painthud",RadarDraw)
	
	//End Radar

	//Support barrier


	Barrier = ents.Create("prop_physics")
	Barrier:SetModel("models/props_c17/concrete_barrier001a.mdl")
	Barrier:SetPos(Vector(0,0,0))
	Barrier:SetMoveType(MOVETYPE_NONE)
	Barrier:SetSkin(math.random(1,2))
	Barrier:SetColor(255,255,255,100)
	Barrier:Spawn()

	function DrawGhost()
		if LocalPlayer():GetActiveWeapon():IsValid() then
			if LocalPlayer():GetActiveWeapon():GetPrintName() == "Support builder" then
				SpawnPos = LocalPlayer():GetPos() + Vector(LocalPlayer():GetAimVector().x,LocalPlayer():GetAimVector().y,0)*100 + Vector(0,0,25)
				TRdat = {}
				TRdat.start = SpawnPos+Vector(0,0,25)
				TRdat.endpos = SpawnPos - Vector(0,0,10000)
				TRdat.filter = player.GetAll()
				
				TRresult = util.TraceLine(TRdat)
				
				BPos = SpawnPos-Vector(0,0,SpawnPos.z-TRresult.HitPos.z)
				BAng = FVecToAng(SpawnPos,LocalPlayer():GetPos())
				if !Barrier:IsValid() then
					Barrier = ents.Create("prop_physics")
					Barrier:SetModel("models/props_c17/concrete_barrier001a.mdl")
					Barrier:SetPos(BPos)
					Barrier:SetMoveType(MOVETYPE_NONE)
					Barrier:SetSkin(math.random(1,2))
					Barrier:SetColor(255,255,255,100)
					Barrier:Spawn()
					Barrier:SetAngles(BAng)
				end
				Barrier:SetPos(BPos)
				Barrier:SetAngles(BAng)
			else
				if Barrier:IsValid() then
					Barrier:Remove()
				end
			end
		end
	end

	hook.Add("Think","DrawGhost",DrawGhost)

	function FVecToAng( vec1, vec2 )
		local ang = ( vec2 - vec1 ):Angle()
		return Angle(0,ang.yaw,0)
	end

	//End barrier
	
	
	//Soldier trace hit

	CritTrace = {}
	Crits = 0
	
	function AddCrit( ply, dmginfo, dir, tr )
		print(dmginfo:GetAttacker():GetClass())
		atk = dmginfo:GetAttacker()
		if atk:IsPlayer() and ply:IsPlayer() then
			table.insert(CritTrace,{atk:GetShootPos(),tr.HitPos})
			Crits = Crits + 1
			timer.Create("undocrit"..Crits,5,1,function()
				table.remove(CritTrace,1)
			end)
		end
	end
	
	hook.Add("PlayerTraceAttack","AddCrit",AddCrit)
	//End trace hit
end